import 'package:aweb5/bean/aplus/material_list_entity.dart';

materialListEntityFromJson(MaterialListEntity data, Map<String, dynamic> json) {
	if (json['msg'] != null) {
		data.msg = json['msg']?.toString();
	}
	if (json['data'] != null) {
		data.data = new MaterialListData().fromJson(json['data']);
	}
	if (json['code'] != null) {
		data.code = json['code']?.toInt();
	}
	return data;
}

Map<String, dynamic> materialListEntityToJson(MaterialListEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['msg'] = entity.msg;
	if (entity.data != null) {
		data['data'] = entity.data.toJson();
	}
	data['code'] = entity.code;
	return data;
}

materialListDataFromJson(MaterialListData data, Map<String, dynamic> json) {
	if (json['total'] != null) {
		data.total = json['total']?.toInt();
	}
	if (json['per_page'] != null) {
		data.perPage = json['per_page']?.toInt();
	}
	if (json['current_page'] != null) {
		data.currentPage = json['current_page']?.toInt();
	}
	if (json['last_page'] != null) {
		data.lastPage = json['last_page']?.toInt();
	}
	if (json['data'] != null) {
		data.data = new List<MaterialListDataData>();
		(json['data'] as List).forEach((v) {
			data.data.add(new MaterialListDataData().fromJson(v));
		});
	}
	return data;
}

Map<String, dynamic> materialListDataToJson(MaterialListData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['total'] = entity.total;
	data['per_page'] = entity.perPage;
	data['current_page'] = entity.currentPage;
	data['last_page'] = entity.lastPage;
	if (entity.data != null) {
		data['data'] =  entity.data.map((v) => v.toJson()).toList();
	}
	return data;
}

materialListDataDataFromJson(MaterialListDataData data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['name'] != null) {
		data.name = json['name']?.toString();
	}
	if (json['author'] != null) {
		data.author = json['author']?.toString();
	}
	if (json['goods_status'] != null) {
		data.goodsStatus = json['goods_status']?.toInt();
	}
	if (json['auth_status'] != null) {
		data.authStatus = json['auth_status']?.toInt();
	}
	if (json['check'] != null) {
		data.check = json['check'];
	}
	return data;
}

Map<String, dynamic> materialListDataDataToJson(MaterialListDataData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['name'] = entity.name;
	data['author'] = entity.author;
	data['goods_status'] = entity.goodsStatus;
	data['auth_status'] = entity.authStatus;
	data['check'] = entity.check;
	return data;
}